<?php
class ZpModule
{
    public function index()
    {
        global $_FANWE;
        $page_args = array();
        $id = (int)$_FANWE['request']['id'];
        $where = " where zp_id=".$id;
       // echo $id;
        $zp_list = array();
        
        $sql = 'SELECT * FROM '.FDB::table('zpku').$where;
        
        if($id > 0)
        {                
                $zp_list = FDB::fetchAll($sql);                        
               // echo $sql;
        } 
        
        $comment_list = array();
        $sql='select * from '.FDB::table('zp_comments').' where cm_zpid='.$id.' order by cmid desc';
        $comment_list = FDB::fetchAll($sql);
        
        $index = 0;
        foreach($comment_list as $common)
        {
            $sql='select * from '.FDB::table('user').' where uid='.$comment_list[$index]['cm_userid'];
            $user_tmp =FDB::fetchAll($sql);
            $comment_list[$index]['username'] = $user_tmp[0]['user_name'];
            $comment_list[$index]['userid']=$user_tmp[0]['uid'];
            $comment_list[$index]['servercode']=$user_tmp[0]['server_code'];
            $comment_list[$index]['cm_time'] = getBeforeTimelag($comment_list[$index]['cm_time']);
            $index++;
        }
        
        $user_list=array();
        
        
        
        include template('page/zpku/zp_index');
	display();
    }
} 
?>
